package com.my.mall.manage.order.controller.orderInfoItems;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.my.mall.manage.order.service.orderInfo.OrderInfoManageService;
import com.my.mall.manage.order.service.orderInfoItems.OrderInfoItemsManageService;
import com.my.mall.manage.order.vo.orderInfoItems.OrderInfoItemsManageVo;

@Controller
@RequestMapping("manage/orderInfoItems")
public class OrderInfoItemsManageController {
	@Autowired
	OrderInfoItemsManageService orderInfoItemsManageService;
	
	@Autowired
	OrderInfoManageService orderInfoManageService;
	
	@RequestMapping("selectOrderInfoItemsListByOrderId")
	@ResponseBody
	public Map<String, Object> selectOrderInfoItemsListByOrderId(String orderNumber,int iDisplayStart, int iDisplayLength) {
		int orderId = orderInfoManageService.getOrderIdByOrderNumber(orderNumber);
		List<OrderInfoItemsManageVo> list = orderInfoItemsManageService.selectOrderInfoItemsListByOrderId(orderId,iDisplayStart, iDisplayLength);
		int size = orderInfoItemsManageService.selectOrderInfoItemsCountByOrderId(orderId);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("iTotalRecords", size);
		map.put("iTotalDisplayRecords", size);
		map.put("aaData", list);
		return map;
	}
}